package lanou.autohome;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

/**
 * Created by dllo on 16/8/23.
 */
public class GroupAdapter extends BaseAdapter{

    private Context mcontext;
    ArrayList<String>strings;

    public GroupAdapter(Context mcontext) {
        this.mcontext = mcontext;
    }

    public void setStrings(ArrayList<String> strings) {
        this.strings = strings;
    }

    @Override
    public int getCount() {
        return strings != null ? strings.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        if(convertView == null){
            convertView = LayoutInflater.from(mcontext).inflate(R.layout.item_group_forum_right , null);
        }
        TextView textView = (TextView) convertView.findViewById(R.id.textview_group_forum_right);
        textView.setText(strings.get(position));
        return convertView;
    }
}
